Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(product-assistant): product memory #27270

Merged
merged 62 commits into from
Jan 10, 2025
Merged

feat(product-assistant): product memory #27270

merged 62 commits into from
Jan 10, 2025

Conversation

skoob13
Copy link
Contributor

@skoob13 skoob13 commented Jan 6, 2025

Problem

LLMs are stateless, so our agents are dumb when questions require details. This PR gives them the ability to remember simple facts about a user's company or product in the core memory. The core memory is a text that the background agent continuously updates using two actions: appending a new fragment and replacing an existing fragment. The memory agent triggers on each new human message (surprisingly cost-effective).

Additionally, the PR includes another agent scraping the initial memory from the Internet. It searches in taxonomy for existing $host (preferable) or $app_namespace (app bundle id) and scrapes relevant sources using Perplexity to automatically fill the agent's initial core memory. However, this information is not always reliable, so we always confirm that we've scraped the memory correctly.

Demos

2025-01-07 18 22 15

2025-01-07 18 26 35

Changes

  • Add onboarding for the agent.
  • Scrape Perplexity for relevant memory about the user's company, product, business model, target audience, and features.
  • Implement simple dynamic forms for confirmation/rejection of scraped info.
  • Compress the scraped memory to a smaller text since Perplexity's output is very verbose.
  • Implement the memory collector agent, which works as a parallel node on every new human message.
  • Replace the product description with the core memory in the agent nodes.

Does this work well for both Cloud and self-hosted?

No

How did you test this code?

Manual testing, unit tests.

Copy link
Contributor

github-actions bot commented Jan 6, 2025

Size Change: 0 B

Total Size: 1.11 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 1.11 MB

compressed-size-action

@skoob13 skoob13 marked this pull request as ready for review January 7, 2025 17:40
@skoob13 skoob13 requested a review from Twixes January 7, 2025 17:40
Twixes added 5 commits January 9, 2025 13:45
Been testing initialization with demo data containing `dropbox.com`. The instructions around "sites like Crunchbase" were confusing the Sonar model, as it was often thinking we're looking at a product _like_ Crunchbase etc. This seems to improve the handling.
Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a few tweaks which should make things work even better. Overall, beautiful stuff

return None

@property
def product_core_memory(self) -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the product_ prefix helps, maybe core_memory_content?

frontend/src/scenes/max/maxLogic.ts Show resolved Hide resolved
@@ -84,7 +84,7 @@ def run(self, state: AssistantState, config: RunnableConfig) -> PartialAssistant
message = chain.invoke(
{
"query_kind": viz_message.answer.kind,
"product_description": self._team.project.product_description,
"product_description": self.product_core_memory,
Copy link
Member

@Twixes Twixes Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this become "core_memory" too?

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@skoob13 skoob13 merged commit fd0f847 into master Jan 10, 2025
99 checks passed
@skoob13 skoob13 deleted the feat/core-agent-memory branch January 10, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants